home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Texteditors / Origami / bindings / fun / buff-chg < prev    next >
Encoding:
Text File  |  1996-09-27  |  3.0 KB  |  109 lines

  1. @if-using not(ocl-file-buff-chg)
  2.    @use (ocl-file-buff-chg)
  3.    ;OCL{{{}}}
  4.    ;OCL{{{  reference description
  5.    @if-using ( FUN-REFERENCE ) ; 1 ;
  6.    Define functions, for moving the cursor between multiple buffers on the
  7.    screen.
  8.    @fi
  9.    ;OCL}}}
  10.    ;OCL{{{  local vars
  11.    ( defvar ( x-cur y-cur b ) )
  12.    ;OCL}}}
  13.    ;OCL{{{  go-offset-buffer
  14.    ( deffun ( x-off y-off ) go-offset-buffer
  15.       ( if >(used-buffers 1)
  16.          ;OCL{{{  search for other buffer in given direction
  17.          (
  18.            ;OCL{{{  init position
  19.            set x-cur store-pos
  20.            if >(x-cur screen-width) ( set x-cur screen-width ) fi
  21.            set x-cur +(x-cur screen-width-offset x-off)
  22.            set y-cur +(screen-height-offset y-off cursor-level)
  23.            ;OCL}}}
  24.            ;OCL{{{  while in current buffer, skipt position
  25.            while
  26.               pre
  27.                ( set b buffer-from-position x-cur y-cur )
  28.                  =(b current-buffer-number)
  29.             ;OCL{{{  one step to border
  30.             ( set x-cur +(x-cur x-off)
  31.               set y-cur +(y-cur y-off)
  32.             )
  33.             ;OCL}}}
  34.            ;OCL}}}
  35.            ;OCL{{{  maybe got buffer and return
  36.            if <>(b 0) ( goto-buffer-number b return-from-macro ) fi
  37.            ;OCL}}}
  38.          )
  39.          ;OCL}}}
  40.         fi
  41.         message ( M_NO_BUFFERS )
  42.       )
  43.    )
  44.    ;OCL}}}
  45.    ;OCL{{{  up-buffer
  46.    ;OCL{{{  reference
  47.    @if-using ( FUN-REFERENCE ) ; 2 ; up-buffer-ref
  48.    ;OCL{{{  up-buffer
  49.    Move the cursor to the buffer above the cursor.
  50.    ;OCL}}}
  51.    @fi
  52.    ;OCL}}}
  53.    ( deffun up-buffer ( go-offset-buffer ( 0 -1 ) ) )
  54.    ;OCL}}}
  55.    ;OCL{{{  down-buffer
  56.    ;OCL{{{  reference
  57.    @if-using ( FUN-REFERENCE ) ; 2 ; down-buffer-ref
  58.    ;OCL{{{  down-buffer
  59.    Move the cursor to the buffer below the cursor.
  60.    ;OCL}}}
  61.    @fi
  62.    ;OCL}}}
  63.    ( deffun down-buffer ( go-offset-buffer ( 0 1 ) ) )
  64.    ;OCL}}}
  65.    ;OCL{{{  left-buffer
  66.    ;OCL{{{  reference
  67.    @if-using ( FUN-REFERENCE ) ; 2 ; left-buffer-ref
  68.    ;OCL{{{  left-buffer
  69.    Move the cursor to the buffer to the left of the cursor.
  70.    ;OCL}}}
  71.    @fi
  72.    ;OCL}}}
  73.    ( deffun left-buffer ( go-offset-buffer ( -1 0 ) ) )
  74.    ;OCL}}}
  75.    ;OCL{{{  right-buffer
  76.    ;OCL{{{  reference
  77.    @if-using ( FUN-REFERENCE ) ; 2 ; right-buffer-ref
  78.    ;OCL{{{  right-buffer
  79.    Move the cursor to the buffer to the right of the cursor.
  80.    ;OCL}}}
  81.    @fi
  82.    ;OCL}}}
  83.    ( deffun right-buffer ( go-offset-buffer ( 1 0 ) ) )
  84.    ;OCL}}}
  85.    ;OCL{{{  previous-buffer
  86.    ;OCL{{{  reference
  87.    @if-using ( FUN-REFERENCE ) ; 2 ; previous-buffer-ref
  88.    ;OCL{{{  previous-buffer
  89.    Switch to the previous buffer.
  90.    ;OCL}}}
  91.    @fi
  92.    ;OCL}}}
  93.    ( deffun previous-buffer ( goto-buffer-number -(current-buffer-number 1) ) )
  94.    ;OCL}}}
  95.    ;OCL{{{  next-buffer
  96.    ;OCL{{{  reference
  97.    @if-using ( FUN-REFERENCE ) ; 2 ; next-buffer-ref
  98.    ;OCL{{{  next-buffer
  99.    Switch to the next buffer.
  100.    ;OCL}}}
  101.    @fi
  102.    ;OCL}}}
  103.    ( deffun next-buffer ( goto-buffer-number +(current-buffer-number 1) ) )
  104.    ;OCL}}}
  105.    ;OCL{{{  undelcare vars and internal func
  106.    ( undeclare ( go-offset-buffer x-cur y-cur b ) )
  107.    ;OCL}}}
  108. @fi
  109.